<?php

declare(strict_types=1);

namespace Modules\Inventory\Models;

use Catch\Base\CatchModel as Model;

/**
 * @property $id
 * @property $plan_no
 * @property $plan_name
 * @property $status
 * @property $org_code
 * @property $remark
 * @property $split_order_rules
 * @property $allow_new_material
 * @property $no_check_order
 * @property $create_adjust_order
 * @property $default_qty
 * @property $inventory_eadline
 * @property $wms_range
 * @property $creator_id
 * @property $created_at
 * @property $updated_at
 * @property $deleted_at
*/
class InventoryPlan extends Model
{


    protected $table = 'inventory_plan';

    protected $fillable = [ 'id', 'plan_no', 'plan_name', 'status', 'org_code', 'remark', 'split_order_rules', 'allow_new_material', 'no_check_order', 'create_adjust_order', 'default_qty', 'inventory_eadline','wms_code', 'wms_range', 'creator_id', 'created_at', 'updated_at', 'deleted_at' ];

    /**
     * @var array
     */
    protected array $fields = ['id','plan_no','plan_name','status','org_code','remark','split_order_rules','allow_new_material','no_check_order','create_adjust_order','default_qty','inventory_eadline','wms_code','wms_range','created_at','updated_at'];

    /**
     * @var array
     */
    protected array $form = ['id','plan_no','plan_name','status','org_code','remark','split_order_rules','allow_new_material','no_check_order','create_adjust_order','default_qty','inventory_eadline','wms_code','wms_range','created_at','updated_at'];

    /**
     * @var array
     */
    public array $searchable = [
        'id' => '=',
        'plan_no' => '=',
        'plan_name' => 'like',
        'status' => '=',
        'org_code' => '=',
    ];

    public function getFields(){
        return $this->fields;
    }

    /**
     * 时间格式化
     * @param $date
     * @return mixed
     */
    protected function serializeDate($date)
    {
        return $date->format('Y-m-d H:i');
    }

}
